{extend name='public/layout' /}
{block name='search'}{/block}
{block name='content'}

<div class="login_bg">
    <div class="loin_mid">
        <div class="tab05">
            <ul class="idTabs">
                <li><a href="{:url('user.login/index')}" class="selected">登录</a></li>
                <li><a href="{:url('user.login/reg')}">注册</a></li>
            </ul>
        </div>
        <form action="{:url('loginDo')}" method="post" name="myForm" id="myForm">
        <div class="loin_body mar04" id="tab01">
            <div class="login_n1"><span class="login_ico05"></span>
                <input name="username" id="username" type="text" class="input04" placeholder="请输入用户名或手机号码">
            </div>

         <div class="login_n1"><span class="login_ico02"></span>
            <input name="password" id="password" type="password" class="input04"  placeholder="请输入密码">
        </div>
            <input type="hidden" name="forward" value="{$forward}">
            <div class="login_n2"><span class="float_r"><a href="{:url('pass')}">忘记密码？</a></span></div>
            <p><a href="javascript:;" onclick="$('#myForm').submit();" class="but22">立即登录</a></p>
            <div class="login_nl" style="text-align:center;">
                {notempty name='usersetting.qq.app_key'}<a href="{:url('user.login/login',['type'=>'qq'])}" style="margin-right:10px;"><img src="__IMG__/login_qq1.gif" alt="qq登录"></a>{/notempty}
                {notempty name='usersetting.sina.app_key'}<a href="{:url('user.login/login',['type'=>'sina'])}"><img src="__IMG__/login_sina1.gif" alt="新浪微博登录"></a>{/notempty}
            </div>
        </div>

        </form>


    </div>
</div>
<script src="__PUBLIC__/js/plugins/jquery.ajax.form.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
    $(function(){
        $('#myForm').ajaxForm({success:complate,dataType:'json'}).submit(function(){
            var username = $('#username').val(),password = $('#password').val();
            if(username.length == 0){
                layer.msg('请填写用户名',{icon:2});
                return false;
            }
            if(password.length<6){
                layer.msg('密码长度至少6位',{icon:2});
                return false;
            }
        });
        function complate(result){
            if(result.status == 1){
                window.location.href = result.uri;
            } else {
                layer.msg(result.msg,{icon:2});
            }
        }
    });

</script>
{/block}